package T03_person;

public class test {
    public static void main(String[] args) {
//        Studen stu = new Studen();
//        stu.lunch();
        overseasStudent vStu = new overseasStudent();
        vStu.lunch();
    }
}

//留学生类
class overseasStudent extends Person{
    public void lunch(){
        this.eat();
        this.drink();

        super.eat();
        super.drink();
    }

    //父类拥有此方法，需要进行重构，  @Override  加上表示子类的重构方法

    @Override
    public void eat(){
        System.out.println("吃饭_overseasStudent");
    };
    @Override
    public void drink(){
        System.out.println("喝水_overseasStudent");
    }
}

class Person{
    public void eat(){
        System.out.println("吃饭");
    };
    public void drink(){
        System.out.println("喝水");
    }
}

class Studen extends Person{
    public void lunch(){
//        就近原则，子类没有，就去寻找父类的方法
        eat();
        drink();
    }
}
